<%@ include file="/WEB-INF/jsp/include.jsp"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>


 <c:url var="form_add_computerType" value="/admin/computerType/formAdd" />
 
<a href="${form_add_computerType}" class="btn btn-primary"><i class="icon-plus icon-white"></i>
	Add computer type</a>

<table class="table table-hover table-condensed">
	<caption>List of Computers type</caption>
	<thead>
		<tr>
			<th>#</th>
			<th>Component name</th>
			<th>max Firewalls</th>
			<th>max HardDisks</th>
			<th>max PowerSupplies</th>
			<th>max NetworkCards</th>
			<th>max RamMemories</th>
			<th>max Processors</th>
			<th>price</th>
			<th>Actions</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach var="comp" items="${computersType}">
		
            <c:url var="delete_computerType" value="/admin/computerType/delete/${comp.idComputer}" />
            
			<tr>
				<td>${comp.idComputer}</td>
				<td>${comp.name}</td>
				<td>${comp.maxFirewalls}</td>
				<td>${comp.maxHardDisks}</td>
				<td>${comp.maxPowerSupplies}</td>
				<td>${comp.maxNetworkCards}</td>
				<td>${comp.maxRams}</td>
				<td>${comp.maxProcessors}</td>
				<td>${comp.price}</td>
				<td><a href="${delete_computerType}"><i class="icon-trash"></i></a></td>
			</tr>

		</c:forEach>

	</tbody>
</table>

<c:url var="firstUrl" value="/admin/computerType/pages/1" />
<c:url var="lastUrl" value="/admin/computerType/pages/${totalPages}" />
<c:url var="prevUrl" value="/admin/computerType/pages/${currentIndex - 1}" />
<c:url var="nextUrl" value="/admin/computerType/pages/${currentIndex + 1}" />

<div class="pagination">
    <ul>
        <c:choose>
            <c:when test="${currentIndex == 1}">
                <li class="disabled"><a href="#">&lt;&lt;</a></li>
                <li class="disabled"><a href="#">&lt;</a></li>
            </c:when>
            <c:otherwise>
                <li><a href="${firstUrl}">&lt;&lt;</a></li>
                <li><a href="${prevUrl}">&lt;</a></li>
            </c:otherwise>
        </c:choose>
        <c:forEach var="i" begin="${beginIndex}" end="${endIndex}">
            <c:url var="pageUrl" value="/admin/computerType/pages/${i}" />
            <c:choose>
                <c:when test="${i == currentIndex}">
                    <li class="active"><a href="${pageUrl}"><c:out value="${i}" /></a></li>
                </c:when>
                <c:otherwise>
                    <li><a href="${pageUrl}"><c:out value="${i}" /></a></li>
                </c:otherwise>
            </c:choose>
        </c:forEach>
        <c:choose>
            <c:when test="${currentIndex == totalPages}">
                <li class="disabled"><a href="#">&gt;</a></li>
                <li class="disabled"><a href="#">&gt;&gt;</a></li>
            </c:when>
            <c:otherwise>
                <li><a href="${nextUrl}">&gt;</a></li>
                <li><a href="${lastUrl}">&gt;&gt;</a></li>
            </c:otherwise>
        </c:choose>
    </ul>
</div>
